3.680 \(\int \frac {\cos (c+d x) (A+C \sec ^2(c+d x))}{a+b \sec (c+d x)} \, dx\)

Optimal. Leaf size=86 \[ \frac {2 \left (a^2 C+A b^2\right ) \tanh ^{-1}\left (\frac {\sqrt {a-b} \tan \left (\frac {1}{2} (c+d x)\right )}{\sqrt {a+b}}\right )}{a^2 d \sqrt {a-b} \sqrt {a+b}}-\frac {A b x}{a^2}+\frac {A \sin (c+d x)}{a d} \]

[Out]

-A*b*x/a^2+A*sin(d*x+c)/a/d+2*(A*b^2+C*a^2)*arctanh((a-b)^(1/2)*tan(1/2*d*x+1/2*c)/(a+b)^(1/2))/a^2/d/(a-b)^(1
/2)/(a+b)^(1/2)

________________________________________________________________________________________

Rubi [A]  time = 0.18, antiderivative size = 86, normalized size of antiderivative = 1.00, number of steps used = 5, number of rules used = 5, integrand size = 31, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.161, Rules used = {4105, 3919, 3831, 2659, 208} \[ \frac {2 \left (a^2 C+A b^2\right ) \tanh ^{-1}\left (\frac {\sqrt {a-b} \tan \left (\frac {1}{2} (c+d x)\right )}{\sqrt {a+b}}\right )}{a^2 d \sqrt {a-b} \sqrt {a+b}}-\frac {A b x}{a^2}+\frac {A \sin (c+d x)}{a d} \]

Antiderivative was successfully verified.

[In]

Int[(Cos[c + d*x]*(A + C*Sec[c + d*x]^2))/(a + b*Sec[c + d*x]),x]

[Out]

-((A*b*x)/a^2) + (2*(A*b^2 + a^2*C)*ArcTanh[(Sqrt[a - b]*Tan[(c + d*x)/2])/Sqrt[a + b]])/(a^2*Sqrt[a - b]*Sqrt
[a + b]*d) + (A*Sin[c + d*x])/(a*d)

Rule 208

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(Rt[-(a/b), 2]*ArcTanh[x/Rt[-(a/b), 2]])/a, x] /; FreeQ[{a,
b}, x] && NegQ[a/b]

Rule 2659

Int[((a_) + (b_.)*sin[Pi/2 + (c_.) + (d_.)*(x_)])^(-1), x_Symbol] :> With[{e = FreeFactors[Tan[(c + d*x)/2], x
]}, Dist[(2*e)/d, Subst[Int[1/(a + b + (a - b)*e^2*x^2), x], x, Tan[(c + d*x)/2]/e], x]] /; FreeQ[{a, b, c, d}
, x] && NeQ[a^2 - b^2, 0]

Rule 3831

Int[csc[(e_.) + (f_.)*(x_)]/(csc[(e_.) + (f_.)*(x_)]*(b_.) + (a_)), x_Symbol] :> Dist[1/b, Int[1/(1 + (a*Sin[e
 + f*x])/b), x], x] /; FreeQ[{a, b, e, f}, x] && NeQ[a^2 - b^2, 0]

Rule 3919

Int[(csc[(e_.) + (f_.)*(x_)]*(d_.) + (c_))/(csc[(e_.) + (f_.)*(x_)]*(b_.) + (a_)), x_Symbol] :> Simp[(c*x)/a,
x] - Dist[(b*c - a*d)/a, Int[Csc[e + f*x]/(a + b*Csc[e + f*x]), x], x] /; FreeQ[{a, b, c, d, e, f}, x] && NeQ[
b*c - a*d, 0]

Rule 4105

Int[((A_.) + csc[(e_.) + (f_.)*(x_)]^2*(C_.))*(csc[(e_.) + (f_.)*(x_)]*(d_.))^(n_)*(csc[(e_.) + (f_.)*(x_)]*(b
_.) + (a_))^(m_), x_Symbol] :> Simp[(A*Cot[e + f*x]*(a + b*Csc[e + f*x])^(m + 1)*(d*Csc[e + f*x])^n)/(a*f*n),
x] + Dist[1/(a*d*n), Int[(a + b*Csc[e + f*x])^m*(d*Csc[e + f*x])^(n + 1)*Simp[-(A*b*(m + n + 1)) + a*(A + A*n
+ C*n)*Csc[e + f*x] + A*b*(m + n + 2)*Csc[e + f*x]^2, x], x], x] /; FreeQ[{a, b, d, e, f, A, C, m}, x] && NeQ[
a^2 - b^2, 0] && LeQ[n, -1]

Rubi steps

\begin {align*} \int \frac {\cos (c+d x) \left (A+C \sec ^2(c+d x)\right )}{a+b \sec (c+d x)} \, dx &=\frac {A \sin (c+d x)}{a d}-\frac {\int \frac {A b-a C \sec (c+d x)}{a+b \sec (c+d x)} \, dx}{a}\\ &=-\frac {A b x}{a^2}+\frac {A \sin (c+d x)}{a d}+\left (\frac {A b^2}{a^2}+C\right ) \int \frac {\sec (c+d x)}{a+b \sec (c+d x)} \, dx\\ &=-\frac {A b x}{a^2}+\frac {A \sin (c+d x)}{a d}+\frac {\left (\frac {A b^2}{a^2}+C\right ) \int \frac {1}{1+\frac {a \cos (c+d x)}{b}} \, dx}{b}\\ &=-\frac {A b x}{a^2}+\frac {A \sin (c+d x)}{a d}+\frac {\left (2 \left (\frac {A b^2}{a^2}+C\right )\right ) \operatorname {Subst}\left (\int \frac {1}{1+\frac {a}{b}+\left (1-\frac {a}{b}\right ) x^2} \, dx,x,\tan \left (\frac {1}{2} (c+d x)\right )\right )}{b d}\\ &=-\frac {A b x}{a^2}+\frac {2 \left (\frac {A b^2}{a^2}+C\right ) \tanh ^{-1}\left (\frac {\sqrt {a-b} \tan \left (\frac {1}{2} (c+d x)\right )}{\sqrt {a+b}}\right )}{\sqrt {a-b} \sqrt {a+b} d}+\frac {A \sin (c+d x)}{a d}\\ \end {align*}

________________________________________________________________________________________

Mathematica [A]  time = 0.24, size = 82, normalized size = 0.95 \[ \frac {-\frac {2 \left (a^2 C+A b^2\right ) \tanh ^{-1}\left (\frac {(b-a) \tan \left (\frac {1}{2} (c+d x)\right )}{\sqrt {a^2-b^2}}\right )}{\sqrt {a^2-b^2}}+a A \sin (c+d x)-A b (c+d x)}{a^2 d} \]

Antiderivative was successfully verified.

[In]

Integrate[(Cos[c + d*x]*(A + C*Sec[c + d*x]^2))/(a + b*Sec[c + d*x]),x]

[Out]

(-(A*b*(c + d*x)) - (2*(A*b^2 + a^2*C)*ArcTanh[((-a + b)*Tan[(c + d*x)/2])/Sqrt[a^2 - b^2]])/Sqrt[a^2 - b^2] +
 a*A*Sin[c + d*x])/(a^2*d)

________________________________________________________________________________________

fricas [A]  time = 0.51, size = 306, normalized size = 3.56 \[ \left [-\frac {2 \, {\left (A a^{2} b - A b^{3}\right )} d x - {\left (C a^{2} + A b^{2}\right )} \sqrt {a^{2} - b^{2}} \log \left (\frac {2 \, a b \cos \left (d x + c\right ) - {\left (a^{2} - 2 \, b^{2}\right )} \cos \left (d x + c\right )^{2} + 2 \, \sqrt {a^{2} - b^{2}} {\left (b \cos \left (d x + c\right ) + a\right )} \sin \left (d x + c\right ) + 2 \, a^{2} - b^{2}}{a^{2} \cos \left (d x + c\right )^{2} + 2 \, a b \cos \left (d x + c\right ) + b^{2}}\right ) - 2 \, {\left (A a^{3} - A a b^{2}\right )} \sin \left (d x + c\right )}{2 \, {\left (a^{4} - a^{2} b^{2}\right )} d}, -\frac {{\left (A a^{2} b - A b^{3}\right )} d x - {\left (C a^{2} + A b^{2}\right )} \sqrt {-a^{2} + b^{2}} \arctan \left (-\frac {\sqrt {-a^{2} + b^{2}} {\left (b \cos \left (d x + c\right ) + a\right )}}{{\left (a^{2} - b^{2}\right )} \sin \left (d x + c\right )}\right ) - {\left (A a^{3} - A a b^{2}\right )} \sin \left (d x + c\right )}{{\left (a^{4} - a^{2} b^{2}\right )} d}\right ] \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cos(d*x+c)*(A+C*sec(d*x+c)^2)/(a+b*sec(d*x+c)),x, algorithm="fricas")

[Out]

[-1/2*(2*(A*a^2*b - A*b^3)*d*x - (C*a^2 + A*b^2)*sqrt(a^2 - b^2)*log((2*a*b*cos(d*x + c) - (a^2 - 2*b^2)*cos(d
*x + c)^2 + 2*sqrt(a^2 - b^2)*(b*cos(d*x + c) + a)*sin(d*x + c) + 2*a^2 - b^2)/(a^2*cos(d*x + c)^2 + 2*a*b*cos
(d*x + c) + b^2)) - 2*(A*a^3 - A*a*b^2)*sin(d*x + c))/((a^4 - a^2*b^2)*d), -((A*a^2*b - A*b^3)*d*x - (C*a^2 +
A*b^2)*sqrt(-a^2 + b^2)*arctan(-sqrt(-a^2 + b^2)*(b*cos(d*x + c) + a)/((a^2 - b^2)*sin(d*x + c))) - (A*a^3 - A
*a*b^2)*sin(d*x + c))/((a^4 - a^2*b^2)*d)]

________________________________________________________________________________________

giac [A]  time = 0.23, size = 136, normalized size = 1.58 \[ -\frac {\frac {{\left (d x + c\right )} A b}{a^{2}} - \frac {2 \, A \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )}{{\left (\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} + 1\right )} a} - \frac {2 \, {\left (C a^{2} + A b^{2}\right )} {\left (\pi \left \lfloor \frac {d x + c}{2 \, \pi } + \frac {1}{2} \right \rfloor \mathrm {sgn}\left (-2 \, a + 2 \, b\right ) + \arctan \left (-\frac {a \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )}{\sqrt {-a^{2} + b^{2}}}\right )\right )}}{\sqrt {-a^{2} + b^{2}} a^{2}}}{d} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cos(d*x+c)*(A+C*sec(d*x+c)^2)/(a+b*sec(d*x+c)),x, algorithm="giac")

[Out]

-((d*x + c)*A*b/a^2 - 2*A*tan(1/2*d*x + 1/2*c)/((tan(1/2*d*x + 1/2*c)^2 + 1)*a) - 2*(C*a^2 + A*b^2)*(pi*floor(
1/2*(d*x + c)/pi + 1/2)*sgn(-2*a + 2*b) + arctan(-(a*tan(1/2*d*x + 1/2*c) - b*tan(1/2*d*x + 1/2*c))/sqrt(-a^2
+ b^2)))/(sqrt(-a^2 + b^2)*a^2))/d

________________________________________________________________________________________

maple [A]  time = 1.07, size = 149, normalized size = 1.73 \[ \frac {2 \arctanh \left (\frac {\tan \left (\frac {d x}{2}+\frac {c}{2}\right ) \left (a -b \right )}{\sqrt {\left (a -b \right ) \left (a +b \right )}}\right ) A \,b^{2}}{d \,a^{2} \sqrt {\left (a -b \right ) \left (a +b \right )}}+\frac {2 \arctanh \left (\frac {\tan \left (\frac {d x}{2}+\frac {c}{2}\right ) \left (a -b \right )}{\sqrt {\left (a -b \right ) \left (a +b \right )}}\right ) C}{d \sqrt {\left (a -b \right ) \left (a +b \right )}}+\frac {2 A \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{d a \left (1+\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}-\frac {2 A b \arctan \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{d \,a^{2}} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(cos(d*x+c)*(A+C*sec(d*x+c)^2)/(a+b*sec(d*x+c)),x)

[Out]

2/d/a^2/((a-b)*(a+b))^(1/2)*arctanh(tan(1/2*d*x+1/2*c)*(a-b)/((a-b)*(a+b))^(1/2))*A*b^2+2/d/((a-b)*(a+b))^(1/2
)*arctanh(tan(1/2*d*x+1/2*c)*(a-b)/((a-b)*(a+b))^(1/2))*C+2/d*A/a*tan(1/2*d*x+1/2*c)/(1+tan(1/2*d*x+1/2*c)^2)-
2/d*A/a^2*b*arctan(tan(1/2*d*x+1/2*c))

________________________________________________________________________________________

maxima [F(-2)]  time = 0.00, size = 0, normalized size = 0.00 \[ \text {Exception raised: ValueError} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cos(d*x+c)*(A+C*sec(d*x+c)^2)/(a+b*sec(d*x+c)),x, algorithm="maxima")

[Out]

Exception raised: ValueError >> Computation failed since Maxima requested additional constraints; using the 'a
ssume' command before evaluation *may* help (example of legal syntax is 'assume(4*a^2-4*b^2>0)', see `assume?`
 for more details)Is 4*a^2-4*b^2 positive or negative?

________________________________________________________________________________________

mupad [B]  time = 4.34, size = 1560, normalized size = 18.14 \[ \text {result too large to display} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((cos(c + d*x)*(A + C/cos(c + d*x)^2))/(a + b/cos(c + d*x)),x)

[Out]

(2*A*b^3*atan(sin(c/2 + (d*x)/2)/cos(c/2 + (d*x)/2)))/(d*(a^4 - a^2*b^2)) + (A*a^3*sin(c + d*x))/(d*(a^4 - a^2
*b^2)) - (A*a*b^2*sin(c + d*x))/(d*(a^4 - a^2*b^2)) - (2*A*a^2*b*atan(sin(c/2 + (d*x)/2)/cos(c/2 + (d*x)/2)))/
(d*(a^4 - a^2*b^2)) + (A*b^2*atan((A^2*b^5*sin(c/2 + (d*x)/2)*(a^2 - b^2)^(3/2)*2i + A^2*b^7*sin(c/2 + (d*x)/2
)*(a^2 - b^2)^(1/2)*2i - C^2*a^7*sin(c/2 + (d*x)/2)*(a^2 - b^2)^(1/2)*1i + C^2*a^4*b*sin(c/2 + (d*x)/2)*(a^2 -
 b^2)^(3/2)*2i - C^2*a^6*b*sin(c/2 + (d*x)/2)*(a^2 - b^2)^(1/2)*1i - A^2*a^2*b^5*sin(c/2 + (d*x)/2)*(a^2 - b^2
)^(1/2)*3i + A^2*a^3*b^4*sin(c/2 + (d*x)/2)*(a^2 - b^2)^(1/2)*1i + A^2*a^4*b^3*sin(c/2 + (d*x)/2)*(a^2 - b^2)^
(1/2)*1i - A^2*a^5*b^2*sin(c/2 + (d*x)/2)*(a^2 - b^2)^(1/2)*1i + C^2*a^4*b^3*sin(c/2 + (d*x)/2)*(a^2 - b^2)^(1
/2)*1i + C^2*a^5*b^2*sin(c/2 + (d*x)/2)*(a^2 - b^2)^(1/2)*1i + A*C*a^2*b^3*sin(c/2 + (d*x)/2)*(a^2 - b^2)^(3/2
)*4i + A*C*a^2*b^5*sin(c/2 + (d*x)/2)*(a^2 - b^2)^(1/2)*2i + A*C*a^3*b^4*sin(c/2 + (d*x)/2)*(a^2 - b^2)^(1/2)*
2i - A*C*a^4*b^3*sin(c/2 + (d*x)/2)*(a^2 - b^2)^(1/2)*2i - A*C*a^5*b^2*sin(c/2 + (d*x)/2)*(a^2 - b^2)^(1/2)*2i
)/(C^2*a^8*cos(c/2 + (d*x)/2) + A^2*a^2*b^6*cos(c/2 + (d*x)/2) - 2*A^2*a^4*b^4*cos(c/2 + (d*x)/2) + A^2*a^6*b^
2*cos(c/2 + (d*x)/2) + C^2*a^4*b^4*cos(c/2 + (d*x)/2) - 2*C^2*a^6*b^2*cos(c/2 + (d*x)/2) + 2*A*C*a^2*b^6*cos(c
/2 + (d*x)/2) - 4*A*C*a^4*b^4*cos(c/2 + (d*x)/2) + 2*A*C*a^6*b^2*cos(c/2 + (d*x)/2)))*(a^2 - b^2)^(1/2)*2i)/(d
*(a^4 - a^2*b^2)) + (C*a^2*atan((A^2*b^5*sin(c/2 + (d*x)/2)*(a^2 - b^2)^(3/2)*2i + A^2*b^7*sin(c/2 + (d*x)/2)*
(a^2 - b^2)^(1/2)*2i - C^2*a^7*sin(c/2 + (d*x)/2)*(a^2 - b^2)^(1/2)*1i + C^2*a^4*b*sin(c/2 + (d*x)/2)*(a^2 - b
^2)^(3/2)*2i - C^2*a^6*b*sin(c/2 + (d*x)/2)*(a^2 - b^2)^(1/2)*1i - A^2*a^2*b^5*sin(c/2 + (d*x)/2)*(a^2 - b^2)^
(1/2)*3i + A^2*a^3*b^4*sin(c/2 + (d*x)/2)*(a^2 - b^2)^(1/2)*1i + A^2*a^4*b^3*sin(c/2 + (d*x)/2)*(a^2 - b^2)^(1
/2)*1i - A^2*a^5*b^2*sin(c/2 + (d*x)/2)*(a^2 - b^2)^(1/2)*1i + C^2*a^4*b^3*sin(c/2 + (d*x)/2)*(a^2 - b^2)^(1/2
)*1i + C^2*a^5*b^2*sin(c/2 + (d*x)/2)*(a^2 - b^2)^(1/2)*1i + A*C*a^2*b^3*sin(c/2 + (d*x)/2)*(a^2 - b^2)^(3/2)*
4i + A*C*a^2*b^5*sin(c/2 + (d*x)/2)*(a^2 - b^2)^(1/2)*2i + A*C*a^3*b^4*sin(c/2 + (d*x)/2)*(a^2 - b^2)^(1/2)*2i
 - A*C*a^4*b^3*sin(c/2 + (d*x)/2)*(a^2 - b^2)^(1/2)*2i - A*C*a^5*b^2*sin(c/2 + (d*x)/2)*(a^2 - b^2)^(1/2)*2i)/
(C^2*a^8*cos(c/2 + (d*x)/2) + A^2*a^2*b^6*cos(c/2 + (d*x)/2) - 2*A^2*a^4*b^4*cos(c/2 + (d*x)/2) + A^2*a^6*b^2*
cos(c/2 + (d*x)/2) + C^2*a^4*b^4*cos(c/2 + (d*x)/2) - 2*C^2*a^6*b^2*cos(c/2 + (d*x)/2) + 2*A*C*a^2*b^6*cos(c/2
 + (d*x)/2) - 4*A*C*a^4*b^4*cos(c/2 + (d*x)/2) + 2*A*C*a^6*b^2*cos(c/2 + (d*x)/2)))*(a^2 - b^2)^(1/2)*2i)/(d*(
a^4 - a^2*b^2))

________________________________________________________________________________________

sympy [F]  time = 0.00, size = 0, normalized size = 0.00 \[ \int \frac {\left (A + C \sec ^{2}{\left (c + d x \right )}\right ) \cos {\left (c + d x \right )}}{a + b \sec {\left (c + d x \right )}}\, dx \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cos(d*x+c)*(A+C*sec(d*x+c)**2)/(a+b*sec(d*x+c)),x)

[Out]

Integral((A + C*sec(c + d*x)**2)*cos(c + d*x)/(a + b*sec(c + d*x)), x)

________________________________________________________________________________________